<template>
  <div class="mainCon">
    <div class="mainCon">
      <div class="containercontent">

        <div class="seachTip selectw100">
          <div class="inlineblock verticalmiddle infoitem">
            <div class="inlineblock verticalmiddle">
              供应商
            </div>
            <div class="inlineblock verticalmiddle informationItem">
              <el-input style="" v-model="searchName" size="mini" placeholder="供应商" @keyup.enter.native="doSearch"></el-input>
            </div>
          </div>
          <div class="inlineblock verticalmiddle infoitem">
            <div class="inlineblock verticalmiddle">
              类型
            </div>
            <div class="inlineblock verticalmiddle informationItem">
              <el-select v-model="supplierType" size="mini"  style="width:100%;" @change = "doSearch" clearable>
                <el-option v-for="item in supplierSelect.itemList" :key="item.code" :label="item.name" :value="item.code">
                </el-option>
              </el-select>
              <!-- <el-input style="" v-model="type" size="mini" placeholder="供应商" @keyup.enter.native="doSearch"></el-input> -->
            </div>
          </div>
          <div class="inlineblock verticalmiddle infoitem">
            <div class="inlineblock verticalmiddle">
              状态
            </div>
            <div class="inlineblock verticalmiddle informationItem">
              <el-select size="mini" v-model="enableStatusValue" @change="doSearch">
                <el-option v-for="item in enableStatus" :key="item.value" :label="item.label" :value="item.value">
                </el-option>
              </el-select>
            </div>
          </div>
          <div class="inlineblock basicRightDistanceA searchIcon">
            <el-button size="mini" @click="doSearch">搜索</el-button>
            <el-button size="mini" @click="emptySearch">清空</el-button>
            <!--<el-button icon="el-icon-search" size="mini" @click="readSupplier(supplierQuery)"></el-button>-->


          </div>
        </div>
        <div class="separaterowTable">
          <div class="tableTittle">
            <div><span class="fontImpact">1</span><span>供应商</span></div>
            <el-button type="primary" icon="el-icon-plus" size="mini" @click="addsupplier" style="float:right" v-if="userOpernation.add.display">添加供应商</el-button>
          </div>
          <el-table :data="supplierTableDate" style="width: 100%" size="mini" class="tableCon">
            <el-table-column label="序号" fixed min-width="50px">
              <template slot-scope="scope">
                {{scope.$index+(supplierQuery.page - 1) * supplierQuery.pageCount + 1}}
              </template>
            </el-table-column>
            <el-table-column property="name" label="名称" fixed min-width="100px" show-overflow-tooltip>
            </el-table-column>
            <el-table-column property="supplierType" label="类型" min-width="100px" :formatter="supFormatter" show-overflow-tooltip>

            </el-table-column>
            <el-table-column property="product" label="提供的产品（服务）" min-width="200px" show-overflow-tooltip>
                <template slot-scope="scope">
                {{scope.row.product == '' || scope.row.product == undefined?"---":scope.row.product}}
              </template>
            </el-table-column>
            <el-table-column property="seniority" label="资质" min-width="100px" show-overflow-tooltip>
              <template slot-scope="scope">
                {{scope.row.seniority == '' || scope.row.seniority == undefined?"---":scope.row.seniority}}
              </template>
            </el-table-column>
            <!--<el-table-column property="address" label="地址" min-width="100px" show-overflow-tooltip>
               <template slot-scope="scope">
                {{scope.row.address == '' || scope.row.address == undefined?"---":scope.row.address}}
              </template>
            </el-table-column>-->
            <el-table-column property="phone" label="电话" min-width="100px" show-overflow-tooltip>
            </el-table-column>
            <!--<el-table-column property="email" label="邮箱" min-width="100px" show-overflow-tooltip>
              <template slot-scope="scope">
                {{scope.row.email == '' || scope.row.email == undefined?"---":scope.row.email}}
              </template>
            </el-table-column>-->
            <el-table-column property="status" label="状态" :formatter='formatter' min-width="100px" show-overflow-tooltip>
            </el-table-column>
            <el-table-column property="updateTime" label="最新审核日期" :formatter="formatterTime" min-width="100px">

            </el-table-column>
            <el-table-column property="planAuditDate" label="计划评审日期" min-width="100px" :formatter="formatterPlanTime">
              <template slot-scope="scope">
                {{scope.row.planAuditDate == '' || scope.row.planAuditDate == undefined?"---":scope.row.planAuditDate}}
              </template>
            </el-table-column>
            <el-table-column label="操作"  min-width="160px">
              <template slot-scope="scope">
                <el-button v-if="scope.row.status=='1' && userOpernation.disable.display" type="text" size="mini" @click="isStart(scope.row)">停用</el-button>
                <el-button v-if="scope.row.status=='0' && userOpernation.enable.display" type="text" size="mini" @click="isStart(scope.row)">启用</el-button>
                <el-button v-if="scope.row.status=='3' && scope.row.isApprove" type="text" size="mini" @click="editSupplier(scope.row,'review')">审核</el-button>
                <el-button type="text" size="mini" @click="editSupplier(scope.row,'edit')" v-if="(scope.row.status =='2' || scope.row.status =='4') && userOpernation.update.display">编辑</el-button>
                <el-button type="text" size="mini" @click="editSupplier(scope.row,'openEdit')" v-if="(scope.row.status =='1') && userOpernation.openUpdate.display">编辑</el-button>
                <el-button type="text" size="mini" @click="editSupplier(scope.row,'look')" v-if="userOpernation.select.display">详情</el-button>
                <el-button type="text" size="mini" @click="deleteSupplier(scope.row)" v-if="scope.row.status=='2' && userOpernation.delete.display">删除</el-button>
              </template>
            </el-table-column>
          </el-table>
          <div class="block changepages">
            <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="supplierQuery.page" :page-sizes="[20,30,40]"
              :page-size="supplierQuery.pageCount" layout="total, sizes, prev, pager, next, jumper" :total="rowNumber">
            </el-pagination>
          </div>
        </div>
      </div>
      <!--<div  v-if="reviewFlowShow">
        <review-flow :reviewData = "reviewData" :procInstType = "procInstType"></review-flow>
      </div>-->
    </div>
    <el-dialog :visible.sync="supplierPop" width="70%" :show-close='false' class="supplierDialog" :closeOnClickModal='false'>
      <span slot="title" class="dialog-title">
		  	{{newOrEdit=='new'?'新增':(newOrEdit=='edit'?'编辑':'查看')}}供应商
			  <el-button @click="close('supplierForm')" size="mini" class="popupClose">关闭</el-button>
			</span>
      <el-form label-width="110px" :inline="false" class="demo-form-inlinen supForm" :model="supplierForm" :rules="supplierRules"
        ref="supplierForm">

        <el-form-item label="名称" prop='name'>
          <el-col :span="22">
            <el-input size="mini" placeholder="名称" v-model="supplierForm.name" :disabled="!canEdit || newOrEdit == 'openEdit'"></el-input>

          </el-col>
        </el-form-item>
        <el-form-item label="类型" prop='supplierType'>
          <el-col :span="22">
            <el-select v-model="supplierForm.supplierType" size="mini" :disabled="!canEdit" style="width:100%;">
              <el-option v-for="item in supplierSelect.itemList" :key="item.code" :label="item.name" :value="item.code">
              </el-option>
            </el-select>
          </el-col>
        </el-form-item>
        <el-form-item label="提供的产品" prop='product'>
          <el-col :span="22">
            <el-input size="mini" placeholder="提供的产品" v-model="supplierForm.product" :disabled="!canEdit"></el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="资质" prop='seniority'>
          <el-col :span="22">
            <el-input size="mini" placeholder="资质" v-model="supplierForm.seniority" :disabled="!canEdit"></el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="地址" prop='address'>
          <el-col :span="22">
            <el-input size="mini" placeholder="地址" v-model="supplierForm.address" :disabled="!canEdit"></el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="电话" prop='phone'>
          <el-col :span="22">
            <el-input size="mini" placeholder="电话" v-model="supplierForm.phone" :disabled="!canEdit"></el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="联系人" prop='liaison'>
          <el-col :span="22">
            <el-input size="mini" placeholder="联系人" v-model="supplierForm.liaison" :disabled="!canEdit"></el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="邮箱" prop='email'>
          <el-col :span="22">
            <el-input size="mini" placeholder="邮箱" v-model="supplierForm.email" :disabled="!canEdit"></el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="计划评审日期" prop='planAuditDate'>
          <el-col :span="22">
            <el-date-picker v-model="supplierForm.planAuditDate" type="date" size="mini" style="width:100%;" :disabled="!canEdit" format="yyyy-MM-dd"
              value-format="yyyy-MM-dd" :picker-options="pickerOptions" placeholder="选择日期">
            </el-date-picker>
          </el-col>
        </el-form-item>
        <el-form-item label="状态" prop="status" v-if="newOrEdit != 'new'">
          <el-col :span="22">
            <el-select v-model="supplierForm.status" size="mini" disabled style="width:100%;">
              <el-option v-for="item in enableStatus" :key="item.value" :label="item.label" :value="item.value">
              </el-option>
            </el-select>
          </el-col>
        </el-form-item>
      </el-form>
      <div class="elTab">
        <el-tabs style="width: 100%;" v-model="activeTab">
          <el-tab-pane label="附件" name="first">
            <form style='visibility: hidden;width: 0;height: 0;'>
              <input type="file" name="file" id="sup-file" @change="getFile" multiple="multiple">
            </form>
            <el-button @click="uploadClick" type="primary" size="mini" style="float:right;margin-bottom:5px" v-if="newOrEdit != 'look' && newOrEdit != 'review'">上传</el-button>

            <el-table :data="supplierForm.files" style="width: 100%;height:calc(100% - 45px)" size="mini" class="tableCon">
              <el-table-column label="序号" min-width="50px">
                <template slot-scope="scope">
                  {{scope.$index+1}}
                </template>
              </el-table-column>
              <el-table-column property="fileName" label="附件名称" min-width="200px" :show-overflow-tooltip="true">
              </el-table-column>
              <el-table-column label="操作" min-width="100px" v-if = "newOrEdit !='look' && newOrEdit !='review'">
                <template slot-scope="scope">
                  <!--如果师新增的话 切割掉一行 编辑的话掉接口删除一行-->
                  <el-button type="text" size="mini" @click="deleteFileNew(scope.$index)" v-if="scope.row.id == undefined && userOpernation.delete.display">删除</el-button>
                  <el-button type="text" size="mini" @click="deleteFileEdit(scope.row,scope.$index)" v-if="scope.row.id != undefined && userOpernation.delete.display">删除</el-button>
                  <el-button type="text" size="mini" @click="downloadattachment(scope.row)" v-if="scope.row.id != undefined && userOpernation.upload.display">下载</el-button>
                </template>
              </el-table-column>
              <el-table-column label="操作" min-width="100px" v-if="newOrEdit =='look' || newOrEdit =='review'">
                <template slot-scope="scope">
                  <el-button type="text" size="mini" @click="downloadattachment(scope.row)" v-if="scope.row.id != undefined && userOpernation.upload.display">下载</el-button>
                </template>
              </el-table-column>
            </el-table>
          </el-tab-pane>
          <el-tab-pane label="审核信息" name="second" v-if="(newOrEdit == 'look') && supplierForm.status != 2 ">
            <div id="myIframe" v-loading="loading1" v-if = "reload" style = "text-align:center;">
                <span style = "color:#909399;line-height:100px;" v-if = "WorkFlowMsg != '' && WorkFlowMsg != undefined" >{{WorkFlowMsg}}</span>

              <iframe :src="url" id="workFlowIframe" ref="workFlowIframe" width="100%" height="100%" frameborder="0" scrolling="auto"></iframe>
            </div>
          </el-tab-pane>
        </el-tabs>
      </div>
      <span slot="footer" class="dialog-footer" v-if="newOrEdit != 'look' && newOrEdit != 'review'" style="clear:both">
          <el-button size="mini" type="primary" @click="submitSubcontractor('commit')" :disabled ="!isRepeat">提 交</el-button>
			    <el-button type="primary" @click="submitSubcontractor('save')" size="mini" v-if="newOrEdit == 'new' || (isStatus == 2 && newOrEdit != 'look')" :disabled ="!isRepeat" >保 存</el-button>
			    <el-button  size="mini" @click="close('supplierForm')">取消</el-button>
			  </span>
      <span slot="footer" class="dialog-footer" v-if="newOrEdit == 'review'" style="clear:both">
          <el-button size="mini" type="primary" @click="reviewFlowPop()">审核</el-button>
			    <el-button  size="mini" @click="close('supplierForm')">取消</el-button>
			  </span>
      <div slot="footer" class="user-footer" v-if="newOrEdit == 'look'">
        <span v-if="supplierForm.createBy != undefined">
			    	 创建人:{{supplierForm.createBy}}
			  	</span>
        <span v-if="supplierForm.createTime != undefined">
			  		创建时间:{{supplierForm.createTime}}
			  	</span>
        <span v-if="supplierForm.updateBy != undefined">
			    	 修改人：{{supplierForm.updateBy}}
			  	</span>
        <span v-if="supplierForm.updateTime != undefined">
			  		修改时间：{{supplierForm.updateTime}}
			  	</span>
      </div>
    </el-dialog>
    <review-flow :addVisible.sync="reviewFlowShow" :reviewData="reviewData" :procInstType="procInstType" :reviewTitle="reviewTitle"
      @reloadMain="readSuppliers"></review-flow>


  </div>
</template>
<script>
  import { mapState } from 'vuex'
  const reviewFlow = () =>
		import('../../../common/reviewFlow.vue');

  export default {
    data() {
      return {
        supplierQuery: {
          page: 1, //第几页
          pageCount: 20, //页面得记录条数，
        },
        rowNumber: 0,
        enableStatusValue: '',
        supplierType:"",
        searchName: '',
        supplierTableDate: [],
        supplierPop: false,
        supplierForm: {
          name: "",
          supplierType: "",
          product: "",
          phone: "",
          seniority: "",
          address: "",
          liaison: "",
          planAuditDate: "",
          email: "",
          fileList: [],
          files: [],
        },
        supplierRules: {
          name: [
            { required: true, type: 'string', message: '请填写名称', trigger: 'blur' },
          ],
          phone: [{ required: true, message: '请填写电话', trigger: 'blur' },],
          supplierType:[{ required: true, message: '请选择供应商类型', trigger: 'change' },],
          // email: [
          //   {
          //     validator: (rule, value, callback) => {

          //       var reg = /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/;
          //       if (value == '' || value == undefined) {
          //         callback();
          //       } else if (!reg.test(value)) {
          //         callback(new Error('请填写正确邮箱'));
          //       } else {
          //         callback();
          //       }
          //     }, trigger: 'blur',
          //   },
          // ],

        },
        newOrEdit: 'new',
        canEdit: true,
        // 设置当前日期之前的不可用
        pickerOptions: {
          disabledDate(time) {
            return time.getTime() < Date.now() - 8.64e7;
          }
        },
        isStatus: '',
        isRepeat: true,
        reviewFlowShow: false, //审核流弹框
        reviewData: null, //点击行需要审核的信息
        procInstType: 't_supplier', //审核流要查的表
        reviewTitle: '供应商',
        url: "",
        reload:false,
        loading1: true,
        activeTab: "first",
        WorkFlowMsg:"",
      }
    },
    props: ["userOpernation"],
    computed: {
      ...mapState(['enableStatus', 'supplierSelect', 'submitType', 'daibanItem', 'daibanItemShow']),
      sampleTypeTable() {
        let that = this;
        return that.$common.objToArr(that.sampleType);
      }
    },
    created() {
      this.$store.dispatch('dogetDictionary') //接收vuestore里面数据字典数据
      this.readSupplier(this.supplierQuery)
      if (this.daibanItemShow) {
        this.editSupplier(this.daibanItem, 'review')
        this.$store.commit('passDaibanItemShow', false)
      }

    },
    watch: {
      daibanItem(newer, older) {
        if (this.daibanItemShow) {
          this.editSupplier(this.daibanItem, 'review')
          this.$store.commit('passDaibanItemShow', false)
        }
      },
      supplierQuery: {
        handler(val, oldVal) {
          this.readSupplier(this.supplierQuery)
        },
        deep: true
      },
      activeTab(val) {
        if (val == 'second') {
          this.reload = true;
          if (process.env.NODE_ENV == 'development') {

            this.url = "../../static/workflow.html?id=" + this.supplierForm.id + "&procInstType=" + this.procInstType + "&fromModel=look"

          } else {
            this.url = "static/workflow.html?id=" + this.supplierForm.id + "&procInstType=" + this.procInstType + "&fromModel=look" + "&timestamp=" + new Date().getTime()

          }
          var that = this;
          // setTimeout(function () {
          //   let iframe = document.getElementById("workFlowIframe");
            window.addEventListener('message', that.handleMessage)
          // }, 3000)
        }
      }

    },
    components: {
      reviewFlow,
    },
    methods: {
      handleMessage(event) {
         console.log(this.loading1)
        //  debugger;
        const data = event.data
        switch (data.cmd) {
          case 'loadingHide':
            this. WorkFlowMsg = "",
            this.loading1 = false;
            break;
          case 'errorMsg':
            this.loading1 = false;
            this.WorkFlowMsg = "没有查询到审核信息"
            break;
        }
      },
      emptySearch() {
        this.searchName = '';
        this.enableStatusValue = '';
        this.supplierType = "";
        this.readSupplier(this.supplierQuery)
      },
      // 处理状态
      formatter(row, column, cellValue, index) {
        return this.util.changeStatus({ cellValue: cellValue, list: this.enableStatus })
      },
      // 处理时间
      formatterTime(row, column) {
        var newDate = /\d{4}-\d{1,2}-\d{1,2}/g.exec(row.updateTime);
        return newDate;
      },
      formatterPlanTime(row, column) {
        var newDate = /\d{4}-\d{1,2}-\d{1,2}/g.exec(row.planAuditDate);
        return newDate;
      },
      // 处理供应商类型
      supFormatter(row, column, cellValue, index) {
        return this.util.codeChangeName({ cellValue: cellValue, list: this.supplierSelect.itemList })
      },
      timeFormatter(row, column, cellValue, index) {
        return this.util.formatterDate({ cellValue: cellValue })
      },
      doSearch() {
        this.supplierQuery.page = 1;
        this.readSupplier(this.supplierQuery)
      },
      // 读取供应商列表
      readSupplier(parp) {
        var params = {
          name: this.searchName,
          status: this.enableStatusValue,
          type:this.supplierType,
          page: parp.page,
          pageCount: parp.pageCount,
        }
        this.$http({
          method: 'post',
          apiUrl: '/resource/readSupplierList.htm',
          params: params,
          isJson: true,
        }).then(res => {
          if (res.code == 0) {
            this.supplierTableDate = res.data;

            if (!res.pageinfo) {
              this.rowNumber = 0;
            } else if (res.pageinfo && !res.pageinfo.rowNumber) {
              this.rowNumber = 0;
            } else {
              this.rowNumber = res.pageinfo.rowNumber;
            }
          }

        })
      },
      addsupplier() {
        this.supplierPop = true;
        this.newOrEdit = 'new';
        this.canEdit = true;
      },
      editSupplier(row, editOrLook) {

        this.newOrEdit = editOrLook;
        if (editOrLook == 'look' || editOrLook == 'review') {
          this.canEdit = false;
        } else {
          this.canEdit = true;
        }
        this.$http({
          method: 'post',
          apiUrl: '/resource/readSupplier.htm',
          params: { id: row.id },
          isJson: false,
        }).then(res => {
          if (res.code === 0) {
            this.supplierPop = true;
            res.data.files = res.data.fileList;
            this.supplierForm = res.data;

            this.isStatus = this.supplierForm.status;
          }

        })
      },
      deleteSupplier(row) {
        this.$confirm('是否删除', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.$http({
            method: 'post',
            apiUrl: '/resource/deleteSupplier.htm',
            params: {
              id: row.id,
            },
            isJson: false,
          }).then(res => {
            if (res.code === 0) {
              this.$message({
                type: 'success',
                message: '删除成功!'
              });
              this.readSupplier(this.supplierQuery)
            }
          })
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消删除'
          });
        });
      },
      submitSubcontractor(val) {
        this.$refs.supplierForm.validate((valid) => { //表单验证
          if (valid) {
            var formData = new FormData();
            for (var i in this.supplierForm.files) {
              console.log(this.supplierForm.files[i])
              formData.append("files", this.supplierForm.files[i])
            }

            formData.append("name", this.supplierForm.name);
            formData.append("supplierType", this.supplierForm.supplierType);
            formData.append("product", this.supplierForm.product)
            formData.append("phone", this.supplierForm.phone)
            formData.append("seniority", this.supplierForm.seniority)
            formData.append("address", this.supplierForm.address)
            formData.append("planAuditDate", this.supplierForm.planAuditDate)
            formData.append("email", this.supplierForm.email)
            formData.append("liaison", this.supplierForm.liaison)
            var mes = "";
            if (val == 'commit') {
              // data.status = "1"
              formData.append("submitType", this.submitType.submitOpen)
              //  data.submitType = this.submitType.submitOpen;
              mes = "保存成功"
            } else if (val == 'save') {
              formData.append("submitType", this.submitType.submitDraft)
              mes = "提交成功"
            }
            if (this.newOrEdit == 'new') {
              var url = '/resource/createSupplier.htm';
            } else {
              var url = '/resource/updateSupplier.htm';
              // data.id = this.supplierForm.id;
              formData.append("id", this.supplierForm.id)
            }
            this.isRepeat = false;
            this.$http({
              method: 'post',
              apiUrl: url,
              params: formData,
              headers: { 'Content-Type': 'multipart/form-data' }
            }).then(res => {
              this.isRepeat = true;

              if (res.code == 0) {
                this.$notify({
                  type: 'success',
                  message: mes,
                  title:"成功"
                });
                this.readSupplier(this.supplierQuery)
                this.close('supplierForm');
              }

            }).catch(() => {

            });

          } else {
            return false;
          }
        });
      },
      uploadClick() { //上传
        document.getElementById("sup-file").click()
      },
      getFile(event) {   //上传 把文件加入到files数组（必须循环）

        for (var i = 0; i < event.target.files.length; i++) {
          event.target.files[i].fileName = event.target.files[i].name
          this.supplierForm.files.push(event.target.files[i])
        }
        event.target.value= "";
      },
      // 下载附件
      downloadattachment(row) {
        var url = "/download/fileDownload.htm"
        let token = sessionStorage.getItem('loginAccount')?sessionStorage.getItem('loginAccount'):undefined
        window.open(process.env.baseUrl + url + '?id=' + row.id + "&token=" + token);
      },
      deleteFileNew(index) {
        this.supplierForm.files.splice(index, 1)
      },
      deleteFileEdit(row, index) {  //如果
        this.$confirm('是否删除', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.$http({
            method: 'post',
            apiUrl: '/download/fileDelete.htm',
            params: {
              id: row.id,
            },
            isJson: false,
          }).then(res => {
            if (res.code === 0) {
              this.$message({
                type: 'success',
                message: '删除成功!'
              });
              this.supplierForm.files.splice(index, 1)
            }
          })
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消删除'
          });
        });
      },

      close(formName) {
        this.supplierPop = false;
        this.$refs[formName].resetFields();
        this.supplierForm = {
          name: "",
          supplierType: "",
          product: "",
          phone: "",
          seniority: "",
          address: "",
          liaison: "",
          planAuditDate: "",
          email: "",
          files: [],
        };
        this.isRepeat = true;
        this.reload = false;
        this.activeTab = "first";
        this.loading1 = true;
        this.WorkFlowMsg = "";
      },
      isStart(row) {
        var msg = row.status == 0 ? "启用" : "停用";
        this.$confirm("是否" + msg, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
            this.$http({
              method: 'post',
              apiUrl: '/resource/supplierStatus.htm',
              params: {
                id: row.id,
                status: row.status == 0 ? 1 : 0,

              },
              isJson: false,
            }).then(res => {
              if (res.code === 0) {
                this.readSupplier(this.supplierQuery)

              }

            })
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消' + msg
          });
        });
      },
      reviewFlowPop(row) {
        this.reviewFlowShow = true;
        this.reviewData = this.supplierForm;
      },
      readSuppliers() {
        this.$store.dispatch('getWorkflowList', 0).then(res => {
					this.$notify({
						showClose: true,
						message: '操作成功',
						type: 'success',
						title:"成功"
					})
				})
        this.close('supplierForm')
        this.readSupplier(this.supplierQuery)

      },

      handleSizeChange: function (val) {
        this.supplierQuery.pageCount = val;
      },
      handleCurrentChange: function (val) {
        this.supplierQuery.page = val;
      },

      changeHas: function (index, changeval, old) {
        this.supplierTable[index][changeval] = (old == 1) ? 0 : 1;
      }
    }
  }

</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
  /*.el-table__fixed-body-wrapper,.el-table__body-wrapper {
        height: calc(100% - 36px)
    }*/

  .seachTip .infoitem {
    width: calc(100%/4);
  }

  .informationItem {
    width: calc(100% - 78px);
    float: none;
    margin-left: 8px;
  }

  .el-table__fixed-body-wrapper,
  .el-table__body-wrapper {
    height: calc(100% - 36px)
  }

  .supplierDialog .el-form .el-form-item {
    display: inline-block;
    width: 48%;
    margin-bottom: 5px;
  }
</style>
<style>
  .supplierDialog .el-dialog {
    margin-top: 10vh !important;
    height: 80%;
  }

  .supplierDialog .el-dialog .supForm {
    height: 240px;
  }

  .supplierDialog .el-dialog .elTab {
    height: calc(100% - 240px)
  }

  .supplierDialog .el-dialog .elTab .el-tabs {
    height: 100%
  }

  .supplierDialog .el-dialog .elTab .el-tabs .el-tabs__content {
    height: calc(100% - 40px)
  }

  .supplierDialog .el-dialog .elTab .el-tabs .el-tabs__content .el-tab-pane {
    height: 100%
  }

  .supplierDialog .el-dialog .el-dialog__body {
    height: calc(100% - 85px);
    padding: 10px;
  }

  .supplierDialog .user-footer {
    height: 35px;
    line-height: 35px;
  }
</style>
